package com.yanqu.road.dataHelper.action.excel;

import com.yanqu.road.dataHelper.gameServer.GameServer;
import com.yanqu.road.dataHelper.manager.ActivityMgr;
import com.yanqu.road.dataHelper.manager.BaseMgr;
import com.yanqu.road.dataHelper.manager.DataMgr;
import com.yanqu.road.dataHelper.repair.BaseRepair;
import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.player.UserInfo;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author xx
 * @Date 2020/11/11
 */
public class TrystAc extends BaseRepair {

    public TrystAc(GameServer gameServer) {
        super(gameServer);
    }

    @Override
    public void repair(long param1, String param2) {

    }

    public void caishiGet(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        String dateStart = DateHelper.getCurrentDateTimeString(activityInfo.getBeginShowTime()*1000);
        String dateEnd = DateHelper.getCurrentDateTimeString(activityInfo.getEndShowTime()*1000);
        listMap = caishiGetLog();
        DataMgr.addData(listMap);
    }

    private List<Map<String, String>> caishiGetLog() {
        Map<String, String> tempData = new ConcurrentHashMap<>();
        List<Map<String, String>> dataList = new ArrayList<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,time FROM t_l_get_beauty WHERE beautyId = 103317";
        try {
            call = getGameServer().getLogConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",checkNullToEmpty(rs.getString("userId")));
                temp.put("日期",checkNullToEmpty(rs.getString("time")));
                dataList.add(temp);
            }
            getCaishiguanData(tempData,dataList);
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }


    public void acJoin(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        String dateStart = DateHelper.getCurrentDateTimeString(activityInfo.getBeginShowTime()*1000);
        String dateEnd = DateHelper.getCurrentDateTimeString(activityInfo.getEndShowTime()*1000);
        listMap = getAcJoin(activityId,dateStart,dateEnd);
        DataMgr.addData(listMap);
    }

    private List<Map<String, String>> getAcJoin(int activityId,String outStartTime,String outEndTime) {
        Map<String, String> tempData = new ConcurrentHashMap<>();
        List<Map<String, String>> dataList = new ArrayList<>();
        ResultSet rs = null;
        CallableStatement call = null;
        //圣诞节120108
        //银饰道具ID：120042
        //召唤符道具ID：120060
        //司南道具ID：120118
        //彩风寻诗不知道什么懒觉ID：120225
        String sqlAllUserId = "SELECT userId,activityId,LEFT(time,10) as time FROM t_l_activity_reward " +
                "WHERE activityId = ? AND reward like '%120225%' GROUP BY userId,TO_DAYS(time)";
        try {
            call = getGameServer().getLogConnection().prepareCall(sqlAllUserId);
            int i=1;
            call.setInt(i++,activityId);
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",checkNullToEmpty(rs.getString("userId")));
                temp.put("日期",checkNullToEmpty(rs.getString("time")));
                dataList.add(temp);
            }
            getCaishiguanData(tempData,dataList);
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }




    public void acUser(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        String dateStart = DateHelper.getCurrentDateTimeString(activityInfo.getBeginShowTime()*1000);
        String dateEnd = DateHelper.getCurrentDateTimeString(activityInfo.getEndShowTime()*1000);
        listMap = getAcUser(activityId,dateStart,dateEnd);
        DataMgr.addData(listMap);
    }

    private List<Map<String, String>> getAcUser(int activityId,String dateStart , String dateEnd) {
        List<Map<String, String>> dataList = new ArrayList<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlLog = "SELECT userId FROM t_l_login WHERE `time` >= ? AND `time` <= ? GROUP BY userId";
        Map<String,String> rechargeMap = getRechargeAllUserData(dateStart,dateEnd);
        try {
            call = getGameServer().getLogConnection().prepareCall(sqlLog);
            int i=1;
            call.setString(i++,dateStart);
            call.setString(i++,dateEnd);
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                String userId = rs.getString("userId");
                Map<String,String> userInfo = getUserInfo2(userId);
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",userId);
                temp.put("注册时间",userInfo.get("registerTime"));
                temp.put("vip经验",userInfo.get("vipExp"));
                temp.put("活动期间充值金额",rechargeMap.getOrDefault(userId,"0"));
                dataList.add(temp);
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }

    private Map<String, String> getRechargeAllUserData(String outStartTime,String outEndTime) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;

        String sqlAllUserId = "SELECT userId,sum(amount) as allAmount FROM t_u_recharge_detail " +
                "WHERE createTime > ? AND createTime < ? AND (orderStatus = 1 OR orderStatus = 2) " +
                "GROUP BY userId";
        String sqlAllTUserId = "SELECT userId,sum(amount) as allAmount FROM t_u_thirdparty_recharge " +
                "WHERE createTime > ? AND createTime < ? AND (orderStatus = 1 OR orderStatus = 2) " +
                "GROUP BY userId";
        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            call.setString(i++,outStartTime);
            call.setString(i++,outEndTime);
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("allAmount")));
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        try {
            call = getGameServer().getConnection().prepareCall(sqlAllTUserId);
            int i=1;
            call.setString(i++,outStartTime);
            call.setString(i++,outEndTime);
            rs = call.executeQuery();
            while (rs.next()) {
                String userId = rs.getString("userId");
                if(dataList.containsKey(userId)){
                    long recharge = Long.valueOf(dataList.get(userId));
                    dataList.put(userId,(recharge + Long.valueOf(rs.getString("allAmount")).toString()));
                }else{
                    dataList.put(userId,(rs.getString("allAmount")));
                }
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }



    public void goAllActivity(int activityId){
        go(activityId);
    }

    //活动详情
    public void goAllActivityAll(int activityId){
        go1(activityId);
    }

    public void goAllActivityPIFU(int activityId){
        go2(activityId);
    }

    private void go(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        String dateStart = DateHelper.getCurrentDateTimeString(activityInfo.getBeginShowTime()*1000);
        String dateEnd = DateHelper.getCurrentDateTimeString(activityInfo.getEndShowTime()*1000);
        listMap = getLog1(activityId);
        DataMgr.addData(listMap);
    }

    private void go1(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        long beginShowTime = activityInfo.getBeginShowTime();
        long endShowTime = activityInfo.getEndShowTime();
        long outStartTime = beginShowTime;
        long outEndTime = beginShowTime + 24*60*60;
        for(;outEndTime <= endShowTime;){
            String dateStart = DateHelper.getCurrentDateTimeString(outStartTime*1000);
            String dateEnd = DateHelper.getCurrentDateTimeString(outEndTime*1000);
            listMap.add(getLog2(dateStart,dateEnd));
            outStartTime = outEndTime;
            outEndTime = outEndTime + 24*60*60;
        }
        DataMgr.addData(listMap);
    }

    private void go2(int activityId){
        List<Map<String, String>> listMap = new ArrayList<>();
        BaseMgr.getMgr(ActivityMgr.class).initActivity(activityId);
        ActivityInfo activityInfo = ActivityMgr.getActivityInfo(activityId);
        if(activityInfo == null){
            System.err.println("没有找到活动");return;
        }
        if(!activityInfo.getServerIdList().contains(getGameServer().getServerInfo().getServerId())){
            System.err.println(activityId + "不是" + getGameServer().getServerInfo().getServerId()+"的活动");return;
        }
        long beginShowTime = activityInfo.getBeginShowTime();
        long endShowTime = activityInfo.getEndShowTime();
        long outStartTime = beginShowTime;
        long outEndTime = beginShowTime + 24*60*60;
        for(;outEndTime <= endShowTime;){
            String dateStart = DateHelper.getCurrentDateTimeString(outStartTime*1000);
            String dateEnd = DateHelper.getCurrentDateTimeString(outEndTime*1000);
            listMap = getLog3(dateStart,dateEnd);
            outStartTime = outEndTime;
            outEndTime = outEndTime + 24*60*60;
        }
        DataMgr.addData(listMap);
    }

    //触发礼包一条龙三个日志
    public void go1(){
        int activityId = 9007986;
        go(activityId);
    }
    //
    private List<Map<String, String>> getLog1(int activityId) {
        List<Map<String, String>> dataList = new ArrayList<>();
        Map<String, String> maxConditionIdMap = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        //幽会活动是70
        //灵猫献宝 76
        //灵狐  98
        String sql = "SELECT userId,activityId,MAX(`value`+0) as `value` FROM t_u_activity_condition " +
                "WHERE activityId = ? AND type = 70 " +
                "GROUP BY userId";
        String sql2 = "SELECT userId,activityId,max(conditionId) conditionId FROM t_u_activity_condition " +
                "WHERE activityId = ? AND type = 70 AND isGetReward = 1 " +
                "GROUP BY userId";
        try {
            call = getGameServer().getConnection().prepareCall(sql2);
            int i=1;
            call.setInt(i++,activityId);
            rs = call.executeQuery();
            while (rs.next()) {
                maxConditionIdMap.put(rs.getString("userId"),checkNullToEmpty(rs.getString("conditionId")));
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        try {
            call = getGameServer().getConnection().prepareCall(sql);
            int i=1;
            call.setInt(i++,activityId);
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",checkNullToEmpty(rs.getString("userId")));
                UserInfo userInfo = getUserInfo(temp.get("userId"));
                temp.put("openId",String.valueOf(userInfo.getOpenId()));
                temp.put("activityId",checkNullToEmpty(rs.getString("activityId")));
                temp.put("活动值(value)",checkNullToEmpty(rs.getString("value")));
                if(maxConditionIdMap.containsKey(temp.get("userId"))){
                    ActivityConditionInfo activityConditionInfo = ActivityMgr.getActivityConditionInfo(activityId,Integer.valueOf(maxConditionIdMap.get(temp.get("userId"))));
                    temp.put("领奖物品数",String.valueOf(activityConditionInfo.getParamList().get(3)));
                }else{
                    temp.put("领奖物品数","0");
                }
                dataList.add(temp);
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }

    //太卡了不行
    private Map<String, String> getLog2(String outStartTime,String outEndTime) {
        Map<String, String> tempData = new ConcurrentHashMap<>();
        List<Map<String, String>> dataList = new ArrayList<>();
        ResultSet rs = null;
        CallableStatement call = null;
        /*String sqlAllUserId = "SELECT userId FROM t_l_goods  " +
                "WHERE time > ? AND time < ? AND goodsId = 120108 " +
                "GROUP BY userId";*/
        //圣诞节120108
        //银饰道具ID：120042
        //召唤符道具ID：120060
        //司南道具ID：120118
        //彩风寻诗不知道什么懒觉ID：120225
        String sqlAllUserId = "SELECT userId FROM t_l_activity_reward " +
                "WHERE time > ? AND time < ? AND reward like '%120225%' " +
                "GROUP BY userId";
        try {
            call = getGameServer().getLogConnection().prepareCall(sqlAllUserId);
            int i=1;
            call.setString(i++,outStartTime);
            call.setString(i++,outEndTime);
            tempData.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
            tempData.put("date",outStartTime);
            tempData.put("活动参与人数","0");
            tempData.put("活动付费人数","0");
            tempData.put("活动付费金额","0");
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",checkNullToEmpty(rs.getString("userId")));
                dataList.add(temp);
            }
            tempData.put("活动参与人数",String.valueOf(dataList.size()));
            getRechargeData(tempData,dataList,outStartTime,outEndTime);
//            getXiaoshimeiData(tempData,dataList);
//            getMiaoJiangData(tempData,dataList);
//            getJiPaiData(tempData,dataList);
//            getYaohuData(tempData,dataList);
            getCaishiguanData(tempData,dataList);
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return tempData;
    }
    private List<Map<String, String>> getLog3(String outStartTime,String outEndTime) {
        List<Map<String, String>> dataList = new ArrayList<>();
        ResultSet rs = null;
        CallableStatement call = null;
        /*String sqlAllUserId = "SELECT userId FROM t_l_goods  " +
                "WHERE time > ? AND time < ? AND goodsId = 120108 " +
                "GROUP BY userId";*/
        //圣诞节120108
        //银饰道具ID：120042
        //召唤符道具ID：120060
        //司南道具ID：120118
        //彩风寻诗才是官皮肤ID：120225
        String sqlAllUserId = "SELECT userId,reward,`time` FROM t_l_activity_reward " +
                "WHERE time > ? AND time < ? AND reward like '%109520%' " +
                "GROUP BY userId";
        try {
            call = getGameServer().getLogConnection().prepareCall(sqlAllUserId);
            int i=1;
            call.setString(i++,outStartTime);
            call.setString(i++,outEndTime);
            rs = call.executeQuery();
            while (rs.next()) {
                Map<String,String> temp = new ConcurrentHashMap<>();
                temp.put("serverId",String.valueOf(getGameServer().getServerInfo().getServerId()));
                temp.put("userId",checkNullToEmpty(rs.getString("userId")));
                temp.put("皮肤奖励",checkNullToEmpty(rs.getString("reward")));
                temp.put("time",checkNullToEmpty(rs.getString("time")));
                dataList.add(temp);
            }
        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return dataList;
    }


    private Map<String, String> getRechargeData(Map<String, String> data,List<Map<String, String>> userList,String outStartTime,String outEndTime) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,sum(amount) as allAmount FROM t_u_recharge_detail " +
                "WHERE createTime > ? AND createTime < ? AND (orderStatus = 1 OR orderStatus = 2) " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            call.setString(i++,outStartTime);
            call.setString(i++,outEndTime);
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("allAmount")));
            }
            int rechargeUser = 0;
            int rechargeAllCount = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    rechargeUser++;
                    rechargeAllCount += Integer.valueOf(dataList.get(userInfo.get("userId")));
                }
            }
            data.put("活动付费人数",String.valueOf(rechargeUser));
            data.put("活动付费金额",String.valueOf(rechargeAllCount));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }

    private Map<String, String> getXiaoshimeiData(Map<String, String> data,List<Map<String, String>> userList) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,beautyId FROM t_u_beauty " +
                "WHERE beautyId = 103302 " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("beautyId")));
            }
            int xiaoshimeiUser = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    xiaoshimeiUser++;
                }
            }
            data.put("小师妹拥有人数",String.valueOf(xiaoshimeiUser));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }

    private Map<String, String> getMiaoJiangData(Map<String, String> data,List<Map<String, String>> userList) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,beautyId FROM t_u_beauty " +
                "WHERE beautyId = 103300 " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("beautyId")));
            }
            int xiaoshimeiUser = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    xiaoshimeiUser++;
                }
            }
            data.put("苗疆圣女拥有人数",String.valueOf(xiaoshimeiUser));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }


    private Map<String, String> getJiPaiData(Map<String, String> data,List<Map<String, String>> userList) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,beautyId FROM t_u_beauty " +
                "WHERE beautyId = 103313 " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("beautyId")));
            }
            int xiaoshimeiUser = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    xiaoshimeiUser++;
                }
            }
            data.put("鸡排妹拥有人数",String.valueOf(xiaoshimeiUser));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }

    //妖狐
    private Map<String, String> getYaohuData(Map<String, String> data,List<Map<String, String>> userList) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,beautyId FROM t_u_beauty " +
                "WHERE beautyId = 103314 " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("beautyId")));
            }
            int xiaoshimeiUser = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    xiaoshimeiUser++;
                }
            }
            data.put("狐妖掌柜拥有人数",String.valueOf(xiaoshimeiUser));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }

    //采诗官
    private Map<String, String> getCaishiguanData(Map<String, String> data,List<Map<String, String>> userList) {
        Map<String, String> dataList = new ConcurrentHashMap<>();
        ResultSet rs = null;
        CallableStatement call = null;
        String sqlAllUserId = "SELECT userId,beautyId FROM t_u_beauty " +
                "WHERE beautyId = 103317 " +
                "GROUP BY userId";

        try {
            call = getGameServer().getConnection().prepareCall(sqlAllUserId);
            int i=1;
            rs = call.executeQuery();
            while (rs.next()) {
                dataList.put(checkNullToEmpty(rs.getString("userId")),checkNullToEmpty(rs.getString("beautyId")));
            }
            int xiaoshimeiUser = 0;
            for (Map<String,String> userInfo : userList){
                if(dataList.containsKey(userInfo.get("userId"))){
                    xiaoshimeiUser++;
                }
            }
            data.put("采诗官拥有人数",String.valueOf(xiaoshimeiUser));

        } catch (SQLException ex) {
            getGameServer().getLogger().error("异常错误", ex);
        } finally {
            getGameServer().closeConnection(call, rs);
        }
        return data;
    }


}
